package com.glorious.controller;

import com.glorious.common.Result;
import com.glorious.dto.response.system.SysUserAuthResponse;
import com.glorious.entities.OauthClientDetails;
import com.glorious.service.IOauthClientDetailsService;
import com.glorious.service.ISysUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/client/users")
public class SysUserController {

    @Autowired
    private ISysUserService iSysUserService;

    /**
     * 提供用于用户登录认证信息
     */
    @ApiOperation(value = "根据用户名获取用户信息")
    @ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "path", dataType = "String")
    @GetMapping("/username/{username}")
    public Result<SysUserAuthResponse> getUserByUsername(@PathVariable String username) {
        SysUserAuthResponse user = iSysUserService.getUserByUsername(username);
        return Result.success(user);
    }
}
